import Vue from 'vue'
import Router from 'vue-router'
import AppIndex from '../components/home/AppIndex'
import Login from '../components/Login'
import Home from '../components/Home'
import Info from "../components/Info/Info";
import Expend from "../components/Info/Expend";
import Income from "../components/Info/Income";
import Type from "../components/Info/Type";
import Way from "../components/Info/Way";
import AddExpend from "../components/add/AddExpend";
import UpdateExpend from "../components/update/UpdateExpend";
import AddType from "../components/add/AddType";
import UpdateType from "../components/update/UpdateType";
import AddIncome from "../components/add/AddIncome";
import UpdateIncome from "../components/update/UpdateIncome";
import AddWay from "../components/add/AddWay";
import UpdateWay from "../components/update/UpdateWay";
import Register from "../components/Register";
import Modify from "../components/modify/modify";
import Sum from "../components/sum/Sum";
import Debt from "../components/Info/Debt";
import AddDebt from "../components/add/AddDebt";
import UpdateDebt from "../components/update/UpdateDebt";
import ExpendSum from "../components/sum/ExpendSum";
import IncomeSum from "../components/sum/IncomeSum";
import Admin from "../components/admin/Admin";
import User from "../components/admin/User";
import AddUser from "../components/admin/AddUser";
import UpdateUser from "../components/admin/UpdateUser";
import AdminExpend from "../components/admin/expend/AdminExpend";
import AdminUpdateExpend from "../components/admin/expend/AdminUpdateExpend";
import AdminAddExpend from "../components/admin/expend/AdminAddExpend";
import AdminAddIncome from "../components/admin/income/AdminAddIncome";
import AdminIncome from "../components/admin/income/AdminIncome";
import AdminUpdateIncome from "../components/admin/income/AdminUpdateIncome";
import AdminAddType from "../components/admin/type/AdminAddType";
import AdminType from "../components/admin/type/AdminType";
import AdminUpdateType from "../components/admin/type/AdminUpdateType";
import AdminAddWay from "../components/admin/way/AdminAddWay";
import AdminUpdateWay from "../components/admin/way/AdminUpdateWay";
import AdminWay from "../components/admin/way/AdminWay";
import AdminAddDebt from "../components/admin/debt/AdminAddDebt";
import AdminDebt from "../components/admin/debt/AdminDebt";
import AdminUpdateDebt from "../components/admin/debt/AdminUpdateDebt";

Vue.use(Router)


export default new Router({
  mode: 'history',
  routes: [
    {
      path: '/',
      redirect: '/index'
    },
    {
      path: '/home',
      name: 'Home',
      component: Home,
      // home页面并不需要被访问
      redirect: '/index',
      children: [
        {
          path: '/index',
          name: 'AppIndex',
          component: AppIndex,
          meta: {
            requireAuth: true
          }
        },
        {
          path: '/info',
          name: 'Info',
          component: Info,
          redirect: '/expend',
          children: [
            {
              path: '/expend',
              component: Expend,
              meta: {
                requireAuth: true
              }
            },
            {
              path: '/income',
              component: Income,
              meta: {
                requireAuth: true
              }
            },
            {
              path: '/debt',
              component: Debt,
              meta: {
                requireAuth: true
              }
            },
            {
              path: '/type',
              component: Type,
              meta: {
                requireAuth: true
              }
            },
            {
              path: '/way',
              component: Way,
              meta: {
                requireAuth: true
              }
            },
            {
              path: '/addExpend',
              component: AddExpend,
              meta: {
                requireAuth: true
              }
            },
            {
              path: '/updateExpend',
              component: UpdateExpend,
              meta: {
                requireAuth: true
              }
            },
            {
              path: '/addType',
              component: AddType,
              meta: {
                requireAuth: true
              }
            },,
            {
              path: '/updateType',
              component: UpdateType,
              meta: {
                requireAuth: true
              }
            },
            {
              path: '/addIncome',
              component: AddIncome,
              meta: {
                requireAuth: true
              }
            },
            {
              path: '/addDebt',
              component: AddDebt,
              meta: {
                requireAuth: true
              }
            },
            {
              path: '/updateIncome',
              component: UpdateIncome,
              meta: {
                requireAuth: true
              }
            },
            {
              path: '/updateDept',
              component: UpdateDebt,
              meta: {
                requireAuth: true
              }
            },
            {
              path: '/addWay',
              component: AddWay,
              meta: {
                requireAuth: true
              }
            },,
            {
              path: '/updateWay',
              component: UpdateWay,
              meta: {
                requireAuth: true
              }
            },
            {
              path: '/modify',
              component: Modify,
              meta: {
                requireAuth: true
              }
            },
            {
              path: '/sum',
              component: Sum,
              meta: {
                requireAuth: true
              }
            },
            {
              path: '/expendSum',
              component: ExpendSum,
              meta: {
                requireAuth: true
              }
            },
            {
              path: '/incomeSum',
              component: IncomeSum,
              meta: {
                requireAuth: true
              }
            },
          ],
          meta: {
            requireAuth: true
          }
        }
      ]
    },
    {
      path: '/admin',
      component: Admin,
      children: [
        {
          path: '/user',
          name: 'user',
          component: User,
          meta: {
            requireAuth: true
          }
        },
        {
          path: '/addUser',
          name: 'addUser',
          component: AddUser,
          meta: {
            requireAuth: true
          }
        },
        {
          path: '/updUser',
          name: 'updUser',
          component: UpdateUser,
          meta: {
            requireAuth: true
          }
        },
        {
          path: '/adminEx',
          name: 'adminEx',
          component: AdminExpend,
          meta: {
            requireAuth: true
          }
        },
        {
          path: '/adminUpdEx',
          name: 'adminUpdEx',
          component: AdminUpdateExpend,
          meta: {
            requireAuth: true
          }
        },
        {
          path: '/adminAddEx',
          name: 'adminAddEx',
          component: AdminAddExpend,
          meta: {
            requireAuth: true
          }
        },
        {
          path: '/adminIn',
          name: 'adminIn',
          component: AdminIncome,
          meta: {
            requireAuth: true
          }
        },
        {
          path: '/adminUpdIn',
          name: 'adminUpdIn',
          component: AdminUpdateIncome,
          meta: {
            requireAuth: true
          }
        },
        {
          path: '/adminAddIn',
          name: 'adminAddIn',
          component: AdminAddIncome,
          meta: {
            requireAuth: true
          }
        },

        {
          path: '/adminType',
          name: 'adminType',
          component: AdminType,
          meta: {
            requireAuth: true
          }
        },
        {
          path: '/adminUpdType',
          name: 'adminUpdType',
          component: AdminUpdateType,
          meta: {
            requireAuth: true
          }
        },
        {
          path: '/adminAddType',
          name: 'adminAddType',
          component: AdminAddType,
          meta: {
            requireAuth: true
          }
        },

        {
          path: '/adminWay',
          name: 'adminWay',
          component: AdminWay,
          meta: {
            requireAuth: true
          }
        },
        {
          path: '/adminUpdWay',
          name: 'adminUpdWay',
          component: AdminUpdateWay,
          meta: {
            requireAuth: true
          }
        },
        {
          path: '/adminAddWay',
          name: 'adminAddWay',
          component: AdminAddWay,
          meta: {
            requireAuth: true
          }
        },

        {
          path: '/adminDebt',
          name: 'adminDebt',
          component: AdminDebt,
          meta: {
            requireAuth: true
          }
        },
        {
          path: '/adminUpdDebt',
          name: 'adminUpdDebt',
          component: AdminUpdateDebt,
          meta: {
            requireAuth: true
          }
        },
        {
          path: '/adminAddDebt',
          name: 'adminAddDebt',
          component: AdminAddDebt,
          meta: {
            requireAuth: true
          }
        },

      ],
      meta: {
        requireAuth: true
      }
    },
    {
      path: '/login',
      name: 'Login',
      component: Login
    },
    {
      path: '/register',
      name: 'Register',
      component: Register
    }
  ]
})

